<!--
 * @Author: gyp
 * @Date: 2020-05-12 16:31:30
 * @LastEditors: gyp
 * @LastEditTime: 2020-06-19 11:54:27
 * @Description: 设备table表格
 * @FilePath: \sy_kjxc_web\src\views\screen\components\equipTable.vue
 -->

<template>
  <div class="equipTable">
    <el-table :data="tableDatas && tableDatas.rows" border class="blueTable" style="width:100%">
      <el-table-column type="index" label="序号" width="50" />
      <el-table-column prop="name" label="装备名"  min-width="80"/>
      <el-table-column prop="numbers" label="数量" min-width="60" />
      <el-table-column prop="createTime" label="入库时间" min-width="60" />
    </el-table>
    <Pagination :tabledatas="tableDatas" :isScreen="true" @comgetData="findEquipmentByParam" />
  </div>
</template>

<script>
import Pagination from '@/components/Pagination';
export default {
  name: 'equip-table',
  props: ['platformId'],
  components: {
    Pagination
  },
  data () {
    return {
      tableDatas: {
        pageNum: 1,
        pageSize: 10,
        total: 0,
        rows: []
      } // 表格数据
    };
  },
  created () {
    this.findEquipmentByParam();
  },
  methods: {
    findEquipmentByParam (pageNumber = 1) {
      let params = {
        platformId: this.platformId,
        pageNumber: pageNumber,
        pageSize: 10
      };
      this.$api.screen.findEquipmentByParam(params).then(res => {
        this.tableDatas = {
          ...res.data,
          pageNum: pageNumber,
          pageSize: 10
        };
      });
    },
    // 每行点击操作
    handleClick () {}
  }
};
</script>

<style lang="less" scoped>
  .equipTable {
    margin-top: 5px;
  }
</style>
